package cn.kgc.springbootday0102.service.impl;

import cn.kgc.springbootday0102.entity.User;
import cn.kgc.springbootday0102.mapper.UserMapper;
import cn.kgc.springbootday0102.service.UserService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 课工场
 * @date 2024/5/28
 * @description
 */
@Service
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;
    @Override
    public Integer save(User user) {

        return userMapper.insert(user);
    }

    @Override
    public Integer removeById(Integer id) {

        return userMapper.deleteById(id);
    }

    @Override
    public Integer updateById(User user) {

        userMapper.updateById(user);
        return null;
    }

    @Override
    public List<User> getList() {

        return  userMapper.selectList();
    }

    @Override
    public User getById(Integer id) {

        return userMapper.selectById(id);
    }
}
